package com.ruoyi.prod.es;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.ruoyi.common.core.annotation.Excel;
import com.ruoyi.common.core.web.domain.BaseEntity;
import com.ruoyi.prod.domain.TbProdInfo;
import lombok.Data;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.*;

import java.io.Serializable;
import java.util.Date;
import java.util.List;

/**
 * @author zhaijiaqi
 * @version 1.0
 * @description: TODO
 * @date 2025/8/7 19:42
 */
@Document(indexName = "es_prod")
@Setting(shards = 1,replicas = 0)
@Data
public class EsProd implements Serializable {

    /** 商品ID */
    @Id
    @Field(type = FieldType.Keyword)
    private Integer prodId;

    /** SPU */
    @Excel(name = "SPU")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String prodSpu;

    /** 商品类型 */
    @Excel(name = "商品类型")
    @Field(type = FieldType.Integer)
    private Integer prodKind;

    /** 商品分类 */
    @Excel(name = "商品分类")
    @Field(type = FieldType.Integer)
    private Integer prodType;

    /** 商品状态 */
    @Excel(name = "商品状态")
    @Field(type = FieldType.Integer)
    private Integer prodStatus;

    /** 商品名称 */
    @Excel(name = "商品名称")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String prodName;

    /** 商品品牌 */
    @Excel(name = "商品品牌")
    @Field(type = FieldType.Integer)
    private Integer brandId;

    /** 商品单位 */
    @Excel(name = "商品单位")
    @Field(type = FieldType.Integer)
    private Integer unitId;

    /** 商品标签 */
    @Excel(name = "商品标签")
    @Field(type = FieldType.Integer)
    private Integer tagId;

    /** 供应商 */
    @Excel(name = "供应商")
    @Field(type = FieldType.Text,index = false)
    private String appr;

    /** 缩略图 */
    @Excel(name = "缩略图")
    @Field(type = FieldType.Text,index = false)
    private String prodImage;

    /** 品牌名称 */
    @Excel(name = "品牌名称")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String brandName;

    /** 类型名称 */
    @Excel(name = "类型名称")
    @Field(type = FieldType.Text,analyzer = "ik_max_word")
    private String typeName;

    /** 商品信息信息 */
    @Field(type = FieldType.Text,index = false)
    private List<TbProdInfo> tbProdInfoList;


    /** 创建时间 */
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8",shape =JsonFormat.Shape.STRING)
    @Field(type = FieldType.Date,format = {},pattern = "yyyy-MM-dd HH:mm:ss")
    private Date createTime;
}
